package com.taxi.driver.module.order.pool;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;

import com.taxi.driver.R;
import com.taxi.driver.common.BaseActivity;

import javax.inject.Inject;


/**
 * 可抢订单 池
 * Created by FTL
 */
public class PoolActivity extends BaseActivity {

    @Inject
    PoolPresenter mPoolPresenter;

    PoolFragment mPoolFragment;

    public static void start(Context context) {
        Intent intent = new Intent(context, PoolActivity.class);
        context.startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_pool);

        if (mPoolFragment == null) {
            mPoolFragment = PoolFragment.newInstance();
            FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
            transaction.add(R.id.fragment_container, mPoolFragment);
            transaction.commit();
        }
    }

    @Override
    public void onAttachFragment(Fragment fragment) {
        super.onAttachFragment(fragment);
        if (fragment instanceof PoolFragment) {
            mPoolFragment = (PoolFragment) fragment;
        }
    }
}
